During the last couple of days I have evaluated some tools for directory synchronization. My favorite was DirSync Pro, but I had one major problem with it: It does not delete files. The problem can be reproduced as:

  • Synchronize 2 Directories (A and B, two way) - Now the contents of both directories are the same.
  • Delete a file from A
  • Synchronize again - The deleted file in A will be restored from B

I do not like this behaviour, so today I wrote my own little tool. It stores the current state of each directory after each run. When it is run again it will analyze the state of the directory and compare it to the stored state. Then it tries to figure out all the actions that took place. It performs these steps for both directories to synchronize, and when there are no conflicting actions it will reproduce the actions from directory A in B and vice versa.

The tool does not support conflict resolution yet: When conflicting actions are found they are just printed out, and the user of the tool has to resolve them. It might not detect all ADD/MODIFY or MODIFY/MODIFY conflicts since it does not yet compare files byte by byte. It also might destroy all your data, cause your computer to explode or do something worse ;)

A preview version can be downloaded here: DSync-v01dr01.jar. Update: There is a new version of DSync: DSync-v01ds05.jar It can be started from the command line with the following command:

java -jar DSync-v01dr01.jar directory1 directory2

I will probably publish the source code under an open source license (AL2 or similar) when I have a little bit more time to polish it. I also want to do some testing before I publish the code.